package com.tongcao.cn.config;

import com.tongcao.cn.inteceptor.MyIntecerptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import javax.annotation.Resource;

/**
 * @Author:tongcao
 * @Date:2018/8/23 18:47
 * Description:自定义拦截器
 */
@Configuration
public class WebAppConfig extends WebMvcConfigurerAdapter {

    @Resource
    MyIntecerptor myIntecerptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(myIntecerptor).addPathPatterns("/test/**").excludePathPatterns("api/**");
    }
}
